// 引入express
const express = require('express')
// 引入连接池模块
const pool = require('../pool.js')
const router = express.Router()

// 修改密码
router.put('/xgmm', (req, res, next) => {
  var obj = req.body
  pool.query('update user set ? where uid=?', [obj, obj.uid], (err, r) => {
    if (err) {
      return next(err)
    }
    if (r.changedRows === 0) {
      res.send({ code: 400, msg: '修改失败' })
    } else {
      res.send({ code: 200, msg: '修改成功' })
    }
  })
})
module.exports = router
